package com.solidtrust.app;

public class ProductAPI{

	private String prex;
	private String token;
	private String params;
	private Product product;
	private String name;
	
	public ProductAPI(String prex, String token, String params, Product product) {
		this.prex = prex;
		this.token = token;
		this.params = params;
		this.product = product;
	}
	
	public ProductAPI(String prex, String token, String params, Product product, String name) {
		this(prex, token, params, product);
		this.name = name;
	}
	
	public String getUrl(){
		return prex + product.apiName + "?token=" + token + params;
	}

	public String getCountUrl(){
		return prex + "visits?token=" + token + "&productNO=" + product.id; 
	}
	
	public String getName(){
		if(name != null){
			return name;
		}
		return product.name;
	}

	public enum Product {
		GANJI_PRICE(1, "Ganji price", "price"),
		IMAGES(2, "Images", "images");
		
		private Integer id;
	
		private String name;
		
		private String apiName;
		
		
	
		private Product(Integer id, String name, String apiName) {
			this.id = id;
			this.name = name;
			this.apiName = apiName;
		}

		public Integer getId() {
			return id;
		}

		public String getName() {
			return name;
		}

		public String getApiName() {
			return apiName;
		}
		
		
	}
	
}
